package com.guigu.www.tangyingmeng.controller;

import com.guigu.www.pojo.BespeakResult;
import com.guigu.www.pojo.PageVo;
import com.guigu.www.pojo.ReturnDiary;
import com.guigu.www.tangyingmeng.service.TymReturnDraryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/diary")
public class TymReturnDiaryController {

    @Autowired
    private TymReturnDraryService service;

    @PostMapping("/seldiaryall")
    public PageVo<ReturnDiary> seldiaryall (@RequestBody Map<String,String> map) {
        PageVo<ReturnDiary> pageVo = service.seldiaryall(map);
        return pageVo;
    }

    @PostMapping("/adddiary")
    public Boolean adddiary (@RequestBody ReturnDiary diary) {
        return service.adddiary(diary);
    }

    @PostMapping("/updiary")
    public Boolean updiary (@RequestBody ReturnDiary diary) {
        return service.updiary(diary);
    }

    @GetMapping("/deldiary/{id}")
    public Boolean deldiary (@PathVariable("id") Integer id) {
        return service.deldiary(id);
    }

    @GetMapping("/seldiaryone/{id}")
    public ReturnDiary seldiaryone (@PathVariable("id") Integer id) {
        return service.seldiaryone(id);
    }

    @PostMapping("/selresultall")
    public List<BespeakResult> selresultall () {
        return service.selresultall();
    }
}
